package cn.wm.e_01;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;

public class MyInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        // 配置链式解码器
        ChannelPipeline pipeline = socketChannel.pipeline();
        //netty提供的处理器  解码成HttpRequest
        pipeline.addLast(new HttpServerCodec());
        //netty提供的聚合处理器
        pipeline.addLast(new HttpObjectAggregator(8192));
        pipeline.addLast(new MyHandler());
    }
}
